<!-- 班级、课程选择小插件 -->
<style type="text/css">
  .layui-form-label{
    font-weight: bold;
  }
</style>



<div class="layui-row"  id='bjkc'>
  <div class="layui-form-item">
    <?php if ($showTitle) {?>
    <div class="layui-inline title1" style="font-size:12pt;padding:10px;color:#fff;min-width: 100px;">
      <?=$this->title;?>
    </div>
    <?php } ?>

    <?php if ($showClass) {?>
    <div class="layui-inline">
      <label class="layui-form-label">选择班级</label>
      <div class="layui-input-inline">
      <select name="classes" lay-verify="" lay-filter='sel_class'>
      <?php
          //生成班级列表
          foreach (@GS('classes') as $key => $v){
            $selected = gs('setup')['class_id'] == $v['id'] ? 'selected' : '';
            echo '<option
            class_name='.$v['name'].'
            value="'. $v['id'] .'" '. $selected .'>'. $v['name'] .'班</option>';
          }
      ?>
      </select>
      </div>
    </div>
    <?php } ?>

    <?php if ($showTask) {?>
    <div class="layui-inline">
      <label class="layui-form-label">选择课程</label>
      <div class="layui-input-inline">
      <select name="tasks" lay-verify="" lay-filter='sel_task'>
      <option value="">请选择课程</option>
      <?php
          foreach (@GS('tasks') as $cat_name => $cat_tasks){
            echo '<optgroup label="'.$cat_name.'">';
              foreach ($cat_tasks as $key => $task) {
                $selected = gs('setup')['task_id'] == $task['id'] ? 'selected' : '';
                printf('<option category_id=%s category_name=%s value=%s  %s >%s</option>'
                  ,$task['category_id'],$cat_name,$task['id'],$selected,$task['name']);
              }
            echo '</optgroup>';
          }
      ?>
      </select>
      </div>
    </div>
    <?php } ?>

  </div>


 </div>

